<html lang="en"><head>
    <meta charset="UTF-8">


    <link rel="apple-touch-icon" type="image/png" href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png">

    <meta name="apple-mobile-web-app-title" content="CodePen">

    <link rel="shortcut icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico">

    <link rel="mask-icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-b4b4269c16397ad2f0f7a01bcdf513a1994f4c94b8af2f191c09eb0d601762b1.svg" color="#111">




    <script src="https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-2c7831bb44f98c1391d6a4ffda0e1fd302503391ca806e7fcc7b9b87197aec26.js"></script>


    <title>Sticky Navigation Menu With Smooth Scrolling</title>

    <link rel="canonical" href="https://codepen.io/prvnbist/pen/GQMPZq">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">

    <style>
        /*** Mixins & Default Styles ***/
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            overflow-x: hidden;
            overflow-y: scroll;
        }

        /*** Color Variables ***/
        /*** Centering Hack ***/
        /*** Header Styles ***/
        header {
            width: 100vw;
            height: 100vh;
            background: #5661f2;
            display: flex;
        }

        /*** Navigation Styles ***/
        nav {
            width: 100vw;
            height: 160px;
            background: #46b2f0;
            display: grid;
            grid-template-columns: 1fr 1fr;
            position: fixed;
            z-index: 10;
            transition: all 0.3s;
        }
        nav.navShadow {
            box-shadow: 0 4px 30px -5px rgba(0, 0, 0, 0.2);
            height: 100px;
        }
        nav.navShadow #word-mark {
            opacity: 0;
        }

        #brand,
        #menu,
        ul {
            display: flex;
            align-items: center;
        }

        #brand {
            padding-left: 40px;
        }

        #logo {
            width: 55px;
            height: 55px;
            background: #fff;
            border-radius: 50%;
            cursor: pointer;
        }

        #word-mark {
            width: 120px;
            height: 20px;
            background: #fff;
            border-radius: 90px;
            margin-left: 20px;
            opacity: 1;
            transition: all 0.3s;
        }

        /*** Menu Styles ***/
        #menu {
            justify-content: flex-end;
            padding-right: 40px;
        }

        li {
            margin-left: 20px;
        }
        li a {
            width: 80px;
            height: 20px;
            background: #fff;
            display: block;
            border-radius: 90px;
        }

        #menu-toggle {
            width: 55px;
            height: 55px;
            background: #2ea8ee;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 50%;
            cursor: pointer;
            display: none;
        }
        #menu-toggle:hover .bar {
            width: 25px;
        }
        #menu-toggle.closeMenu .bar {
            width: 25px;
        }
        #menu-toggle.closeMenu .bar:first-child {
            transform: translateY(7px) rotate(45deg);
        }
        #menu-toggle.closeMenu .bar:nth-child(2) {
            transform: scale(0);
        }
        #menu-toggle.closeMenu .bar:last-child {
            transform: translateY(-7px) rotate(-45deg);
        }

        .bar {
            width: 25px;
            height: 2px;
            background: #fff;
            transition: 0.3s ease-in-out;
        }
        .bar:nth-child(2) {
            width: 20px;
            margin: 5px 0;
        }
        .bar:last-child {
            width: 15px;
        }

        /*** Hero Section Styles ***/
        #hero-section {
            width: 100vw;
            height: calc(100vh - 160px);
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 160px;
        }

        #head-line {
            width: 520px;
            height: 30px;
            background: #fff;
            border-radius: 90px;
            position: relative;
        }
        #head-line:before, #head-line:after {
            content: "";
            height: 30px;
            border-radius: 90px;
        }
        #head-line:before {
            width: 360px;
            background: #fff;
            position: absolute;
            top: -60px;
            left: 50%;
            transform: translate(-50%, 0);
        }
        #head-line:after {
            width: 200px;
            background: #fff;
            position: absolute;
            left: 50%;
            bottom: -60px;
            transform: translate(-50%, 0);
        }

        /*** Section Styles ***/
        section {
            width: 100vw;
            height: calc(100vh - 100px);
            display: flex;
            justify-content: center;
        }
        section:nth-child(odd) {
            background: #fa6c98;
        }
        section:nth-child(even) {
            background: #79edfc;
        }

        #heading {
            width: 120px;
            height: 20px;
            background: #fff;
            border-radius: 90px;
            margin-top: 40px;
        }

        /*** Responsive Menu For Smaller Device ***/
        @media screen and (max-width: 767px) {
            #menu-toggle {
                display: flex;
            }

            ul {
                display: inline-block;
                width: 100vw;
                height: 0;
                background: #79edfc;
                position: absolute;
                top: 160px;
                transform: translate(, );
                box-shadow: 0 5px 30px -4px rgba(0, 0, 0, 0.2);
                transition: all 0.3s;
            }
            ul.showMenu {
                height: 250px;
            }
            ul.showMenu li {
                height: 80px;
                opacity: 1;
                visibility: visible;
            }

            li {
                width: 50%;
                height: 80px;
                float: left;
                padding-left: 40px;
                opacity: 0;
                visibility: hidden;
                margin-left: 0;
                transition: all 0.3s 0.1s;
            }
            li:first-child, li:nth-child(2) {
                margin-top: 80px;
            }

            #head-line {
                transform: scale(0.8);
            }
        }
        #youtube {
            position: fixed;
            right: 2vw;
            bottom: 2vh;
            font-size: 30px;
            color: #fff;
        }
    </style>

    <script>
        window.console = window.console || function(t) {};
    </script>



</head>

<body translate="no">
<header>
    <nav class="">
        <div id="brand">
            <div id="logo"></div>
            <div id="word-mark"></div>
        </div>
        <div id="menu">
            <div id="menu-toggle">
                <div id="menu-icon">
                    <div class="bar"></div>
                    <div class="bar"></div>
                    <div class="bar"></div>
                </div>
            </div>
            <ul style="top: 160px;">
                <li><a href="#section00"></a></li>
                <li><a href="#section01"></a></li>
                <li><a href="#section02"></a></li>
                <li><a href="#section03"></a></li>
            </ul>
        </div>
    </nav>
    <div id="hero-section">
        <div id="head-line"></div>
    </div>
</header>
<section id="section00">
    <div id="heading"></div>
</section>
<section id="section01">
    <div id="heading"></div>
</section>
<section id="section02">
    <div id="heading"></div>
</section>
<section id="section03">
    <div id="heading"></div>
</section><a id="youtube" href="https://www.youtube.com/watch?v=m1IU7zjl1k4" target="_blank" rel="noopener noreferrer"><i class="fa fa-youtube-play"></i></a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script id="rendered-js">
    $(() => {

        //On Scroll Functionality
        $(window).scroll(() => {
            var windowTop = $(window).scrollTop();
            windowTop > 100 ? $('nav').addClass('navShadow') : $('nav').removeClass('navShadow');
            windowTop > 100 ? $('ul').css('top', '100px') : $('ul').css('top', '160px');
        });

        //Click Logo To Scroll To Top
        $('#logo').on('click', () => {
            $('html,body').animate({
                    scrollTop: 0 },
                500);
        });

        //Smooth Scrolling Using Navigation Menu
        $('a[href*="#"]').on('click', function (e) {
            $('html,body').animate({
                    scrollTop: $($(this).attr('href')).offset().top - 100 },
                500);
            e.preventDefault();
        });

        //Toggle Menu
        $('#menu-toggle').on('click', () => {
            $('#menu-toggle').toggleClass('closeMenu');
            $('ul').toggleClass('showMenu');

            $('li').on('click', () => {
                $('ul').removeClass('showMenu');
                $('#menu-toggle').removeClass('closeMenu');
            });
        });

    });
    //# sourceURL=pen.js
</script>





</body></html>